home *** CD-ROM | disk | FTP | other *** search
-
- ///////////////////////////////////////////////////////////
- Program 1.1.
- ///////////////////////////////////////////////////////////
- ; This program copies a string to video-RAM
- ; (in text-mode only). As a result, the string appears
- ; somewhere in the middle of your screen.
- ; Demo program for ExpAsm Chapter1 "Review of Assembly
- ; Language".
- ;
- .DOSSEG
- .MODEL small, c, os_dos, nearstack
- ; SMALL memory model, DOS, DS=SS are selected.
- .DATA ; Start of DATA segment.
- Str DB 'THIS STRING HAS BEEN PRINTED FROM video-RAM$'
- .STACK 100h ; Start of STACK segment.
- .CODE ; Start of CODE segment.
- .STARTUP ; Initialize Segment Registers.
-
- mov ax,0b800h ; Copy address of video-
- mov es,ax ; -RAM to Segment Register ES.
- mov di,1620 ; Copy an offset DI.
- mov bx,OFFSET Str ; BX contains start address
- ; of the string Str now.
- call Out_Str ; Call the procedure Out_Str.
-
- .EXIT 0 ; Generate the ending sequence.
-
- Out_Str PROC NEAR ; Start of NEAR procedure Out_Str.
- Lab: mov al,[bx] ; Copy current byte of Str to AL.
- cmp al,'$' ; Is it the end of the string?
- je Exit_p ; Yes, exit.
-
- mov byte ptr es:[di],al ;Copy the current byte to
- ;video-RAM
- inc di ; Change destination offset
- inc di ; address (two bytes higher).
- inc bx ; Change source offset address.
- jmp Lab ; Unconditional jump
- ;(to the loop start).
-
- Exit_p: ret ; Return to caller
- OUT_STR ENDP ; End of procedure.
-
- END ; End of program.
-
-